package org.ziroom.common.workflow.anno.importer;

import org.springframework.context.annotation.ImportSelector;
import org.springframework.core.type.AnnotationMetadata;

public class ProcessEngineConfig implements ImportSelector {
	
	private static final String ACTIVITI_PROCESS_CONFIG_NAME = "org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl";
	private static final String ACTIVITI_PROCESS_ENGINE_NAME = "org.ziroom.common.workflow.anno.importer.activiti.ActivitiProcessEngineConfig";

	@Override
	public String[] selectImports(AnnotationMetadata importingClassMetadata) {
		try {
			// 通过路径上加载的类，决定初始化的bean
			Class.forName(ACTIVITI_PROCESS_CONFIG_NAME);
			return new String[]{ACTIVITI_PROCESS_ENGINE_NAME};
		} catch (ClassNotFoundException e) {
			// no-op
		}
		return new String[]{};
	}

}